import request from '@/utils/request';
import { id } from 'element-plus/es/locale';

export function getClue(query: any) {
    return request({
        url: '/tienchin/clue/list',
        method: 'get',
        params: query,
    });
}

export function getChange(query: any) {
    return request({
        url: '/tienchin/clue/channels',
        method: 'get',
        params: query,
    });
}

export function deleteId(clueIds: string) {
    return request({
        url: `/tienchin/clue/${clueIds}`,
        method: 'delete',
    });
}


// 新增线索接口
export function addClue(data: any) {
    return request({
        url: '/tienchin/clue',
        method: 'post',
        data,
    });
}

export function getActivity(channelId: number) {
    return request({
        url: `/tienchin/clue/activity/${channelId}`,
        method: 'get',
    });
}


// 修改线索接口
export function updateClue(data: any) {
    return request({
        url: '/tienchin/clue',
        method: 'put',
        data,
    });
}

export function getSummary(clueId: number) {
    return request({
        url: `/tienchin/clue/summary/${clueId}`,
        method: 'get',
    });
}

export function getClueT(clueId: number) {
    return request({
        url: `/tienchin/clue/${clueId}`,
        method: 'get',
    });
}

export function getClueTwo(clueId: number) {
    return request({
        url: `/tienchin/follow/record/clue/${clueId}`,
        method: 'get',
    });
}

// 无效线索
export function addInvalid(data: any) {
    return request({
        url: '/tienchin/clue/invalid',
        method: 'post',
        data,
    });
}

// 线索商机
export function addBusiness(clueId: number) {
    return request({
        url: `/tienchin/clue/to_business/${clueId}`,
        method: 'post',
    });
}

// 线索跟进

export function addFollow(data: number) {
    return request({
        url: '/tienchin/clue/follow',
        method: 'post',
        data
    });
}

// 部门id
export function getTreeselect(query: any) {
    return request({
        url: '/system/dept/treeselect',
        method: 'get',
        params: query
    });
}

// 根据部门id查询
export function getUsers(userId: number) {
    return request({
        url: `/tienchin/clue/users/${userId}`,
        method: 'get',
    });
}

// 分配线索
export function addAssignment(data: any) {
    return request({
        url: '/tienchin/assignment',
        method: 'post',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    });
}